using System;
using System.Collections;
using System.Web.UI.WebControls;

namespace Sedna.Core.Controller.Configurations
{
    public class RowNumberCommandArgumentsGenerator : NameValuePairListCommandArgumentsGenerator
    {
        public override string GenerateCommandArguments(IDataGridColumnConfiguration columnConfiguration, DataGridItem dataGridItem, IExecutionContext executionContext)
        {
            String result = base.GenerateCommandArguments(columnConfiguration, dataGridItem, executionContext);
            
            if (String.Empty.Equals(result))
            {
                return String.Format("index={0}", dataGridItem.DataSetIndex);
            }

            return String.Format("index={0};{1}", dataGridItem.DataSetIndex, result);
        }
    }
}
